import { createApp } from 'vue'
import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'

interface State {
    menus: any;
}
// 创建一个新的 store 实例
const store = createStore<State>({
    state() {
        return {
            menus: []
        }
    },
    mutations: {
        setMenus(state, menus) {
            state.menus = menus;
        }
    },
    getters: {
        getMenus(state) {
            const menus = state.menus;
        }
    },
    //模块
    modules: {},
    //持久化数据
    // plugins: [
    //     createPersistedState({
    //         key: 'vuex', // 存储是的名字
    //         // 也可以是sessionstorage
    //         storage: 'window.localStorage'

    //     })
    // ]
})

export default store 